﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyMvc.IBLL
{
    public partial interface IBaseService<T> where T : class,new()
    {
        //添加
        T AddEntities(T entity);


        //修改
        bool UpdateEntities(T entity);


        //删除
        bool DeleteEntities(T entity);


        //查询
        IQueryable<T> LoadEntities(Func<T, bool> wherelambda);



        /// <summary>
        /// 获取实体列表以及相关实体列表
        /// </summary>
        /// <param name="wherelambda">查询条件</param>
        /// <param name="relatedEntities">相关实体属性名称</param>
        /// <returns></returns>
        IQueryable<T> LoadEntities(Func<T, bool> wherelambda, string relatedEntities);

        //分页
        IQueryable<T> LoadPagerEntities<S>(int pageSize, int pageIndex,
            out int total, Func<T, bool> whereLambda, bool isAsc, Func<T, S> orderByLambda);
    }
}
